# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=automato
pkgver=33.0561b59
pkgrel=9
pkgdesc='Should help with automating some of the user-focused enumeration tasks during an internal penetration test.'
groups=('blackarch' 'blackarch-automation' 'blackarch-recon')
arch=('any')
url='https://github.com/skahwah/automato'
license=('custom:unknown')
depends=('ruby' 'ruby-bundler')
makedepends=('git')
source=("git+https://github.com/skahwah/$pkgname.git")
sha512sums=('SKIP')
install="$pkgname.install"

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md

  rm README.md

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec bundler exec ./$pkgname.rb "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

